package com.winter.client;

import com.winter.base.WinterResponse;
import com.netflix.discovery.EurekaClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JinHao
 * Date: 2023/10/08 14:04
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class ServiceCenterClient {

    private final EurekaClient eurekaClient;

    /**
     * 调用服务下线
     *
     * @return {@link WinterResponse}
     */
    @GetMapping("/deal/eureka/shutdown")
    public WinterResponse<?> shutdown() {
        log.info("[接收服务下线通知]");
        eurekaClient.shutdown();
        log.info("[调用服务下线成功]");
        return WinterResponse.success();
    }
}
